From 0b001be78115956eb3c13d6d6bc2ddd250ac7cac Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Wed, 9 Mar 2005 09:01:46 +0000 Subject: [PATCH] bitkeeper revision 1.1236.12.16 (422ebb7aYVp_Td4UP5dSmJUG7oOtyA) New arch-specific function context_switch() subsumes switch_to() and schedule_tail() which are now not at all visible to common code. Signed-off-by: Keir Fraser --- xen/arch/x86/domain.c | 23 +++++++++++++++++------ xen/common/schedule.c | 14 +------------- xen/include/xen/sched.h | 5 +++-- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index e9ed583507..4be8043bef 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -714,7 +714,7 @@ long do_switch_to_user(void) : /* no output */ \ :"r" ((_ed)->debugreg[_reg])) -void switch_to(struct exec_domain *prev_p, struct exec_domain *next_p) +void context_switch(struct exec_domain *prev_p, struct exec_domain *next_p) { struct tss_struct *tss = init_tss + smp_processor_id(); execution_context_t *stack_ec = get_execution_context(); @@ -805,6 +805,18 @@ void switch_to(struct exec_domain *prev_p, struct exec_domain *next_p) __sti(); switch_segments(stack_ec, prev_p, next_p); + + /* + * We do this late on because it doesn't need to be protected by the + * schedule_lock, and because we want this to be the very last use of + * 'prev' (after this point, a dying domain's info structure may be freed + * without warning). + */ + clear_bit(EDF_RUNNING, &prev_p->ed_flags); + + schedule_tail(next_p); + + BUG(); } @@ -968,16 +980,15 @@ void domain_relinquish_memory(struct domain *d) { if ( pagetable_val(ed->arch.guest_table) != 0 ) { - put_page_and_type( - &frame_table[pagetable_val(ed->arch.guest_table) >> PAGE_SHIFT]); + put_page_and_type(&frame_table[ + pagetable_val(ed->arch.guest_table) >> PAGE_SHIFT]); ed->arch.guest_table = mk_pagetable(0); } if ( pagetable_val(ed->arch.guest_table_user) != 0 ) { - put_page_and_type( - &frame_table[pagetable_val(ed->arch.guest_table_user) >> - PAGE_SHIFT]); + put_page_and_type(&frame_table[ + pagetable_val(ed->arch.guest_table_user) >> PAGE_SHIFT]); ed->arch.guest_table_user = mk_pagetable(0); } } diff --git a/xen/common/schedule.c b/xen/common/schedule.c index be85ec9a89..177a322d75 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -446,23 +446,11 @@ void __enter_scheduler(void) TRACE_2D(TRC_SCHED_SWITCH, next->domain->id, next); - switch_to(prev, next); - - /* - * We do this late on because it doesn't need to be protected by the - * schedule_lock, and because we want this to be the very last use of - * 'prev' (after this point, a dying domain's info structure may be freed - * without warning). - */ - clear_bit(EDF_RUNNING, &prev->ed_flags); - /* Ensure that the domain has an up-to-date time base. */ if ( !is_idle_task(next->domain) && update_dom_time(next) ) send_guest_virq(next, VIRQ_TIMER); - schedule_tail(next); - - BUG(); + context_switch(prev, next); } /* No locking needed -- pointer comparison is safe :-) */ diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 83925b46f5..68fa4e90d4 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -251,8 +251,9 @@ void domain_sleep(struct exec_domain *d); void __enter_scheduler(void); -extern void switch_to(struct exec_domain *prev, - struct exec_domain *next); +extern void context_switch( + struct exec_domain *prev, + struct exec_domain *next); void domain_init(void); -- 2.30.2